<?php
namespace Settings\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\JsonModel;

class SiteController extends AbstractActionController{
    protected $settingsTable;
    
    public function getSettingsTable(){
        if(!$this->settingsTable){
            $sm = $this->getServiceLocator();
            $this->settingsTable = $sm->get('Settings\Model\SettingsTable');
        }
        return $this->settingsTable;
    }
    
    public function indexAction()
    {
        if($this->request->isXmlHttpRequest())
        {
            $sitename = $this->getSettingsTable()->getSitename();
            return new JsonModel(array(
                'success' => 'true',
                'sitename' => 'sitename',
            ));
        }
        else
        {
            return array();
        }
    }
}